package com.qf.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice//当前类是异常解析器 而且每个方法返回的都是JSON 数据
@ControllerAdvice//当前类为异常解析器
public class MyExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
//    @ResponseBody
    public String exception() {
        return "error";
    }
}
